package com.gljr.exam.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import com.gljr.exam.domain.TotalPoints;

public interface TotalPointsRepository extends PagingAndSortingRepository<TotalPoints, Long> {
	@Override
	@Query(value = "SELECT * FROM total_points", nativeQuery = true)
	List<TotalPoints> findAll();

	TotalPoints findByUsername(String username);

	@Modifying
	@Transactional
	@Query("UPDATE TotalPoints SET total = ?2,userexamnb=?3 WHERE username = ?1")
	void updateTotalPoints(String username, Long total, Long userexamnb);
}
